﻿<!DOCTYPE HTML>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/style.css" />
</head>
<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>系统管理 <span class="c-gray en">&gt;</span> 菜单管理 <a id="btn-refresh" onclick="_refresh('getAllMenu.action');" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="text-c"> 
		时间段：
		<input type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'start_date\')||\'%y-%M-%d\'}'})" id="start_date" class="input-text Wdate" style="width:120px;">
		-
		<input type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'end_date\')}',maxDate:'%y-%M-%d'})" id="end_date" class="input-text Wdate" style="width:120px;">
		<button name="search_btn" id="search_btn" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
	</div>
		<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="member_add('添加菜单','<%=basePath%>jsp/menu/add.action','600','400')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加菜单</a> </span> </div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort">
				<thead>
					<tr class="text-c">
						<th width="25"><input type="checkbox" name="" value=""></th>
						<th>菜单名字</th>
						<th>菜单url</th>
						<th>是否可见</th>
						<th>菜单级别</th>
						<th>父菜单</th>
						<th>菜单图标</th>
						<th>操作</th>
					</tr>
				</thead>
				<%-- <tbody>
					<c:forEach items="${menuList}" var="m">
						<tr class="text-c">
							<td><input type="checkbox" value="${m.mid}"></td>
							<td>${m.mname}</td>
							<td>${m.url}</td>
							<td>
								<c:if test="${m.isshow == 1}">展示</c:if>
								<c:if test="${m.isshow == 0}">隐藏</c:if>
							</td>
							<td>${m.level}</td>
							<td>${m.parentMenu}</td>
							<td>${m.icon}</td>
							<td>
								<a name="${m.mid}" style="text-decoration:none" class="ml-5"  href="javascript:;" title="编辑菜单"><i class="Hui-iconfont">&#xe6df;</i></a>
								<a name="${m.mid}" style="text-decoration:none" class="ml-7"  href="javascript:;" title="删除菜单"><i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
						
					</c:forEach>
				</tbody> --%>
				<tbody>
				</tbody>
			</table>
		</div>
	</div>
	<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
	<script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
	<script type="text/javascript" src="<%=basePath%>static/h-ui/js/H-ui.min.js"></script> 
	<script type="text/javascript" src="<%=basePath%>static/h-ui.admin/js/H-ui.admin.js"></script>
	<!--/_footer 作为公共模版分离出去-->
	
	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="<%=basePath%>static/My97DatePicker/WdatePicker.js"></script> 
	<script type="text/javascript" src="<%=basePath%>static/datatables/1.10.0/jquery.dataTables.min.js"></script> 
	<script type="text/javascript" src="<%=basePath%>static/laypage/1.2/laypage.js"></script>
	<script type="text/javascript">
	
	//异步加载数据 
	var action_url="<%=request.getContextPath() %>/jsp/menu/";
	var table;
	table=$('.table-sort').dataTable({
	"ajax":{
			"url":action_url+"selectAllMenuList.action",
			"data": function (d) {  
                d.start_date = $('#start_date').val();  
                d.end_date = $('#end_date').val();
			},
		}, 
	 columns: [
		{ data:
 			 function(obj){ return "<input type='checkbox'  value='"+obj.orderId+"' name='ck_orderId'>"; },
 			 /* class:'text-c', */
 		},
        { data: 'mid' },
        { data: 'mname' },
        { data: 'url' },
        { data: 'isshow' },
        { data: 'level' },
        { data: 'parentMenu' },
        { data: 'icon' },
    ],
	"processing": true,
    "serverSide": true,
    "bSort" : true,// 排序  
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0]}// 不参与排序的列
	]
});
	
	
	
	$('.table-sort').dataTable({
	});
	
	function member_add(title,url,w,h){	
		layer_show(title,url,w,h);
	}
	
	$(function() {
		$("table").on("click" ,".ml-5", function(){
			article_edit('菜单编辑','<%=basePath%>jsp/menu/menuUpdata.action?mid='+this.getAttribute("name"),700,450 )
		});
		
		$("table").on("click" ,".ml-7", function(){
			article_del('删除菜单','<%=basePath%>jsp/menu/menuDelete.action?mid='+this.getAttribute("name") )
		});
	})
	
	function article_edit(title,url,id,w,h){
		layer_show(title,url,id,w,h);
	}
	
	function article_del(title,url){
	layer.confirm('确认删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: url,
			dataType: 'text',
			success: function(data){
				if (data == "success") {
					layer.msg('已删除!',{icon:1,time:1000});
					location.replace(location.href);
				} else {
					layer.msg('删除失败!',{icon:1,time:1000});
					location.replace(location.href);
				}
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
	}
</script> 
</body>
</html>